package jpa_objects;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;

/**
 * @author Alejandro Casas
 * @version 1.0
 * @created 10-Dec-2012 1:01:03 AM
 */
@Entity

public class Review {

	private String date;
	private long id;
	private String mailFrom;
	private String message;
	
	private String title;
	private Sport sport;
	private int calification;
	private String nameFrom;
	//private User from;
	//private User to;
	private boolean usado;
	
	
	/**
	 * @return the calification
	 */
	public int getCalification() {
		return calification;
	}

	/**
	 * @param calification the calification to set
	 */
	public void setCalification(int calification) {
		this.calification = calification;
	}

	/**
	 * @return the date
	 */
	public String getDate() {
		return date;
	}

	/**
	 * @param date the date to set
	 */
	public void setDate(String date) {
		this.date = date;
	}

	/**
	 * @return the id
	 */
	@Id
	@GeneratedValue
	public long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(long id) {
		this.id = id;
	}

	/**
	 * @return the mailFrom
	 */
	public String getMailFrom() {
		return mailFrom;
	}

	/**
	 * @param mailFrom the mailFrom to set
	 */
	public void setMailFrom(String mailFrom) {
		this.mailFrom = mailFrom;
	}

	/**
	 * @return the message
	 */
	public String getMessage() {
		return message;
	}

	/**
	 * @param message the message to set
	 */
	public void setMessage(String message) {
		this.message = message;
	}

	
	/**
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * @param title the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * @return the sport
	 */
	@OneToOne(targetEntity=Sport.class,cascade=CascadeType.ALL)
	public Sport getSport() {
		return sport;
	}

	/**
	 * @param sport the sport to set
	 */
	public void setSport(Sport sport) {
		this.sport = sport;
	}

	/*
	public User getFrom() {
		return from;
	}

	public void setFrom(User from) {
		this.from = from;
	}

	public User getTo() {
		return to;
	}

	public void setTo(User to) {
		this.to = to;
	}
	 */
	
	public boolean isUsado() {
		return usado;
	}

	public void setUsado(boolean usado) {
		this.usado = usado;
	}

	public Review(){

	}

	
	/**
	 * @param date
	 * @param mailFrom
	 * @param message
	 * @param nameFrom
	 * @param title
	 * @param sport
	 */
	public Review(String date, String mailFrom, String message,
			 String title, Sport sport,int calification,String n,User from,User to
			 ,boolean usado) {
		this.date = date;
		this.mailFrom = mailFrom;
		this.message = message;
		
		this.title = title;
		this.sport = sport;
		this.calification=calification;
		nameFrom=n;
		//this.from=from;
		//this.to=to;
		this.usado=usado;
	}

	public void finalize() throws Throwable {

	}

	public String getNameFrom() {
		return nameFrom;
	}
	public void setNameFrom(String n)
	{
		nameFrom=n;
	}

}